#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int res = 0;
        for (int i = 0; i <= 31; ++i)
        {
            int tmp = 0;
            for (auto& ch : nums)
            {
                tmp += (ch >> i) & 1;
            }
            int a = tmp % 3;
            a <<= i;
            res |= a;
            tmp = 0;
        }
        return res;
    }
};
int main()
{
    vector<int> v = { 3,5,9,9,8,9,8,3,3,8 };
    Solution s;
    cout << s.singleNumber(v) << endl;
    return 0;
}
